<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    // get 请求
    const xhr = new XMLHttpRequest();
    xhr.open('GET', "./data/test.json");
    // xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
    xhr.send('123');
    // 异步调用，检测到 readyState 变化时触发
    xhr.onreadystatechange = function () {
        if (xhr.readyState === 4) {
            if (xhr.status === 200) {
                console.log(JSON.parse(xhr.responseText));
            }
        }
    }

</script>

</html>